package src

import (
	"encoding/json"
	"os"

	. "github.com/soekchl/myUtils"
)

type Config struct {
	Port string `json:"port"`
}

func ReadConfig() *Config {
	buff := readFile(configPath)
	if len(buff) < 1 {
		outPutJson(&Config{}, configPath)
		Error("File is Empty ", configPath)
		os.Exit(1)
	}
	err := json.Unmarshal(buff, &config)
	if err != nil {
		Error(err)
		os.Exit(1)
	}
	return config
}
